package com.ulife.order.api;

import com.ulife.common.gateway.utils.annotation.ApiGroup;
import com.ulife.common.gateway.utils.annotation.ApiParameter;
import com.ulife.common.gateway.utils.annotation.DesignedErrorCode;
import com.ulife.common.gateway.utils.annotation.HttpApi;
import com.ulife.common.gateway.utils.define.SecurityType;
import com.ulife.common.gateway.utils.entity.ServiceException;
import com.ulife.order.api.errors.OrderErrorCodes;
import com.ulife.order.api.response.ResponseMessage;
import com.ulife.order.api.response.SoRefundBillInfo;
import com.ulife.order.api.response.SoRefundBillsInfo;
import com.ulife.order.api.response.cms.SoCancelbillListResponse;

import java.util.List;

/**
 * Created by liaodp on 2016/5/31.
 */
@ApiGroup(minCode = 30000, maxCode = 32100, name = "ordercms", owner = "liaodp", codeDefine = OrderErrorCodes.class)
public interface OrderCmsService {
    @HttpApi(name="order.cms.OrderCancel",desc = "取消订单(CMS客服订单取消操作)",security = SecurityType.None,owner ="liaodp")
    @DesignedErrorCode({OrderErrorCodes.ORDER_NOT_FOUND, OrderErrorCodes.ORDER_STATUS_ERROR,
            OrderErrorCodes.ORDER_CANCEL_PARAMETER_ERROR})
    ResponseMessage cmsOrderCancel(@ApiParameter(required = true, name = "sale_no", desc = "订单号") String sale_no,
                                   @ApiParameter(required = false, name = "operator_id", desc = "操作人") long operator_id,
                                   @ApiParameter(required = false, name = "operation_type", desc = "操作类型") int operationType,
                                   @ApiParameter(required = false, name = "cancel_type", desc = "取消类型")String cancelType,
                                   @ApiParameter(required = false, name = "cancel_reason", desc = "取消原因") String cancelReason,
                                   @ApiParameter(required = false, name = "cancel_remark", desc = "取消备注")String cancelRemark,
                                   @ApiParameter(required = false, name = "is_need_refund", desc = "是否需要退款")int isNeedRefund
    ) throws ServiceException;

    @HttpApi(name = "order.cms.socancelbill", desc = "订单取消单据列表", owner = "liaodp", security = SecurityType.None)
    @DesignedErrorCode({OrderErrorCodes.ORDER_NOT_FOUND})
    SoCancelbillListResponse getSoCancelBillList(@ApiParameter(required = false, name = "query", defaultValue = "", desc = "Json字符串") String query,
                                                 @ApiParameter(required = false, name = "page", desc = "页码", defaultValue = "1") int page,
                                                 @ApiParameter(required = false, name = "rows", desc = "每页条数", defaultValue = "20") int rows)
            throws ServiceException;

    @HttpApi(name = "order.processSoCancelBill", desc = "根据订单取消单据生成退款单据", owner = "libq", security = SecurityType.UserLogin)
    @DesignedErrorCode({OrderErrorCodes.SOCANNELBILL_PROCESS_ERROR,OrderErrorCodes.SOCANNELBILL_NOTFOUND_ERROR})
    boolean processSoCancelBill(@ApiParameter(required = true, name = "cancelBillNo", desc = "订单取消单据号")String cancelBillNo)
            throws ServiceException;

    @HttpApi(name = "order.getRefundBillList", desc = "获取订单退款单据列表", owner = "libq", security = SecurityType.None)
    @DesignedErrorCode({OrderErrorCodes.REFUNDBILL_GETLIST_ERROR})
    SoRefundBillsInfo getRefundBillList(
            @ApiParameter(required = true, name = "condition", desc = "查询条件") String condition
            , @ApiParameter(required = false, name = "page", desc = "页码", defaultValue = "1") int page
            , @ApiParameter(required = false, name = "rows", desc = "每页条数", defaultValue = "10") int rows)
            throws ServiceException;

    @HttpApi(name = "order.getRefundBill", desc = "获取退款单据详情", owner = "libq", security = SecurityType.None)
    @DesignedErrorCode({OrderErrorCodes.REFUNDBILL_GET_ERROR,OrderErrorCodes.REFUNDBILL_NOTFOUND_ERROR})
    SoRefundBillInfo getRefundBill(@ApiParameter(required = true, name = "refundBillNo", desc = "退款单号") String refundBillNo)
            throws ServiceException;

    @HttpApi(name = "order.processRefundBill", desc = "回写&处理订单退款单据", owner = "libq", security = SecurityType.UserLogin)
    @DesignedErrorCode({OrderErrorCodes.REFUNDBILL_PROCESS_ERROR,OrderErrorCodes.REFUNDBILL_PROCESS_PARAM_ERROR,OrderErrorCodes.REFUNDBILL_NOTFOUND_ERROR})
    boolean processRefundBill(
            @ApiParameter(required = true, name = "refundBillNo", desc = "退款单号") String refundBillNo
            , @ApiParameter(required = false, name = "data", desc = "回写数据") String data)
            throws ServiceException;

    /**
     *  添加订单备注
     * @param order_no 订单编号
     * @param type 备注类型
     * @param order_status 订单状态
     * @param pay_status 支付状态
     * @param comment 备注
     * @param created_by 创建人
     */
    @HttpApi(name = "order.cms.orderCommons.add", desc = "添加订单备注", owner = "Luohx", security = SecurityType.None)
    boolean addSaleOrderComment(@ApiParameter(required = true, name = "order_no", desc = "订单编号")String order_no,
                                @ApiParameter(required = false, name = "type", desc = "备注类型",defaultValue = "普通备注") String type,
                                @ApiParameter(required = false, name = "order_status", desc = "订单状态") int order_status,
                                @ApiParameter(required = false, name = "pay_status", desc = "支付状态") int pay_status,
                                @ApiParameter(required = true, name = "comment", desc = "备注") String comment,
                                @ApiParameter(required = false, name = "created_by", desc = "创建人") long created_by)throws ServiceException;
}
